package com.yxym.math_;

public class MathMethod {
    public static void main(String[] args) {
        //Math的静态方法
        int abs = Math.abs(-2);//abs绝对值
        System.out.println(abs);
        double pow = Math.pow(2,5);
        System.out.println(pow);//求幂
        double ceil = Math.ceil(-20.022);
        System.out.println(ceil);//向上取整
        double floor = Math.floor(12.56);
        System.out.println(floor);//向下取整
        long round = Math.round(4.613);
        System.out.println(round);//四舍五入
        double sqrt = Math.sqrt(36.0);
        System.out.println(sqrt);//开方
        for (int i = 0; i < 10; i++) {
            System.out.println((int)(2 +Math.random()*(7 - 2 + 1)));//求取一个随机数
        }
        double max = Math.max(20.0,41.0);
        System.out.println(max);
    }
}
